// 防止多次点击造成页面多次跳转
function throttle (fn, gapTime) {
  if (gapTime == null || gapTime == undefined) {
    gapTime = 300;
  }
  let _lastTime = null;
  // 返回新的函数
  return function () {
    let _nowTime = +new Date ();
    if (_nowTime - _lastTime > gapTime || !_lastTime) {
      fn.apply (this, arguments); //将this和参数传给原函数
      _lastTime = _nowTime;
    }
  };
}

export default throttle
// module.exports = {
//   throttle: throttle,
// };